package com.msy.redis;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;

class JedisClusterTest {
    public static void main(String[] args) {
        String ip = "182.92.86.10";
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort(ip, 7001));
        jedisClusterNode.add(new HostAndPort(ip, 7002));
        jedisClusterNode.add(new HostAndPort(ip, 7003));
        jedisClusterNode.add(new HostAndPort(ip, 7004));
        jedisClusterNode.add(new HostAndPort(ip, 7005));
        jedisClusterNode.add(new HostAndPort(ip, 7006));
        JedisCluster jcd = new JedisCluster(jedisClusterNode, config);
        jcd.set("name:004", "zhangfei11111");
        String value = jcd.get("name:004");
        System.out.println(value);
    }

}
